package com.example.activity_service.controller;


import com.example.activity_service.service.impl.LZCServicelmpl;

import com.example.activity_service.vo.Usersj;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController

@ResponseBody
public class LZCController {
    @Autowired
    LZCServicelmpl servicelmpl;
    @Autowired
    LZCServicelmpl lzcServicelmpl;
    //查询
    @RequestMapping("/cxx")
    @ResponseBody
    public List<Usersj> ssss() throws JsonProcessingException {
        List<Usersj> list = lzcServicelmpl.queryActiveUser();
        ObjectMapper objectMapper = new ObjectMapper();
        String json = objectMapper.writeValueAsString(list);
        return list;
    }
    //新增
    @RequestMapping("/xzjd")
    @ResponseBody
    @CrossOrigin
    public String xzdz(
            @RequestParam("parvalue")String parvalue,
            @RequestParam("userid")String user_id
    )
    {
        System.out.println(123);
        System.out.println("==="+user_id);
//        String userid=lzcServicelmpl.userid(user_id);
        lzcServicelmpl.xzjd(user_id,parvalue);

        return "true";

    }
//    //登录
//    @RequestMapping("/log")
//    @ResponseBody
//    @CrossOrigin
//    public int dlu(
//            @RequestParam("account")String account,
//            @RequestParam("tel")String tel
//    ){
//
//        System.out.println(account);
//        System.out.println(tel);
//        int list=lzcServicelmpl.dlu(account, tel).size();
//        System.out.println(list);
//        if (list==1){
//            return list;
//        }
//        return list;
//    }

}
